<?php
/* -------------------------------------------------------------------------------------
* 	ID:						$Id: config.php 11 2013-09-21 11:43:11Z phone.mueller@googlemail.com $
* 	Letzter Stand:			$Revision: 11 $
* 	zuletzt geaendert von:	$Author: siekiera $
* 	Datum:					$Date: 2013-09-21 11:43:11 +0000 (Sat, 21 Sep 2013) $
*
* 	SEO:mercari by Siekiera Media
* 	http://www.seo-mercari.de
*
* 	Copyright (c) since 2011 SEO:mercari
* --------------------------------------------------------------------------------------
* 	based on:
* 	(c) 2000-2001 The Exchange Project  (earlier name of osCommerce)
* 	(c) 2002-2003 osCommerce - www.oscommerce.com
* 	(c) 2003     nextcommerce - www.nextcommerce.org
* 	(c) 2005     xt:Commerce - www.xt-commerce.com
*
* 	Released under the GNU General Public License
* ----------------------------------------------------------------------------------- */

if(isset($_POST['action']) && $_POST['action'] == 'save_widgets') {
	$post = $_POST;
	foreach($post AS $was => $value)
		if($value != 'save_widgets')
			foreach ($value AS $id => $wert)
				$db->db_query("UPDATE ".TABLE_ADMIN_START_PAGE." SET ".$was." = '".$wert."' WHERE id = '".$id."'");

	// nochmaligen $_POST verhindern
	$script = 'window.location = "'.DIR_WS_ADMIN.'start.php";'."\n";
}

?>
<script type="text/javascript">
	<!--
		<?php
		if(!empty($script))
			echo $script;
		else { ?>
			function widgetConfig() {
				$("#widget_panel").dialog({autoOpen:false,show:'fade',height:500,width:600,modal:true,open:function(event,ui){$('.ui-dialog-content').css({backgroundImage:'none'});}});
				setTimeout("$('#widget_panel').dialog('open')", 250);
				return false;
			}
		<?php } ?>
	//-->
</script>
<div id="widget_panel" class="dn">
	<form action="start.php" method="POST" name="save_widgets">
		<?php
			$status = array();
			$status[] = array('id' => '1', 'text' => 'aktiv');
			$status[] = array('id' => '0', 'text' => 'inaktiv');

			$offen = array();
			$offen[] = array('id' => '1', 'text' => 'ja');
			$offen[] = array('id' => '0', 'text' => 'nein');

			$farbe = array();
			$farbe[] = array('id' => 'color-white', 'text' => 'weiß');
			$farbe[] = array('id' => 'color-yellow', 'text' => 'orange');
			$farbe[] = array('id' => 'color-red', 'text' => 'rot');
			$farbe[] = array('id' => 'color-blue', 'text' => 'blau');
			$farbe[] = array('id' => 'color-violett', 'text' => 'lila');
			$farbe[] = array('id' => 'color-green', 'text' => 'grün');
			$farbe[] = array('id' => 'color-silver', 'text' => 'silber');
			$farbe[] = array('id' => 'color-black', 'text' => 'schwarz');

			$getFormData = $db->db_query("SELECT id, widget_name, sort_id, status, offen, farbe FROM ".TABLE_ADMIN_START_PAGE." WHERE id !='1' ORDER BY id ASC");
			echo '<table width="100%" cellpadding="4">';
			echo '	<tr><td><b>'.TEXT_WIDGET_CONFIG_NAME.'</b></td><td><b>'.TEXT_WIDGET_CONFIG_STATUS.'</b></td><td><b>'.TEXT_WIDGET_CONFIG_STATE.'</b></td><td><b>'.TEXT_WIDGET_CONFIG_COLOR.'</b></td></tr>';
			while(!$getFormData->EOF) {
				echo '	<tr>';
				echo 		'<td valign="top" width="1">'.$getFormData->fields['widget_name'].'</td>';
				echo '		<td>'.draw_pull_down_menu('status['.$getFormData->fields['id'].']', $status, $getFormData->fields['status'], 'style="width:auto;"').'</td>';
				echo '		<td>'.draw_pull_down_menu('offen['.$getFormData->fields['id'].']', $offen, $getFormData->fields['offen'], 'style="width:auto;"').'</td>';
				echo '		<td>'.draw_pull_down_menu('farbe['.$getFormData->fields['id'].']', $farbe, $getFormData->fields['farbe'], 'style="width:auto;"').'</td>';
				echo '	</tr>';
				$getFormData->MoveNext();
			}
			echo '</table>';
		?>
		<div class="ar"><button type="submit" class="button">Werte speichern</button></div>
		<input type="hidden" name="action" value="save_widgets" />
	</form>
</div>